package org.misty.seckill.exception;

import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 1.判断当前登录用户是否有权限执行某个操作
 * 2.权限不足返回状态码：403 Forbidden
 * 3.未登录或者已登录但没有访问权限
 */
@NoArgsConstructor
public class AuthorizationException extends ApplicationException {
  @Getter
  private boolean signOut = false;

  public AuthorizationException(String message) {
    super(message);
  }

  public static AuthorizationException signOut() {
    var e = new AuthorizationException("未登录");
    e.signOut = true;
    return e;
  }

//  public static <T> T throwSignOut() {
//    throw signOut();
//  }
}
